home *** CD-ROM | disk | FTP | other *** search
- #include "const.h"
- #include "globals.h"
- #include "utils.h"
- #include "patches.h"
-
- #include "midistuff.h"
-
- #define GNEChannel 1
- #define GNEVoice 116
- #define GNEPitch 20
- #define GNEVelocity 64
-
- #define FRChannel 2
- #define FRVoice 31
- #define FRPitch 40
- #define FRVelocity 100
-
- #define IUChannel 3
- #define IUVoice 14
- #define IUPitch 70
- #define IUVelocity 100
-
- #define TKChannel 4
- #define TKVoice 10
- #define TKPitch 60
- #define TKVelocity 120
-
-
- #define UpdateInterval 20
- unsigned long lastUpdate;
- void InitGlobals(void)
- {
- lastUpdate = 0L;
- }
-
- void UpdateChannels( void)
- {
- unsigned long now;
- GetDateTime(&now);
- if (now > (lastUpdate + UpdateInterval))
- {
- lastUpdate = now;
- ProgramChannels();
- }
- }
-
- void ProgramChannels( void)
- {
- SetProgramChannel(GNEChannel, GNEVoice);
- SetProgramChannel(FRChannel, FRVoice);
- SetProgramChannel(IUChannel, IUVoice);
- SetProgramChannel(TKChannel, TKVoice);
- }
-
-
-
- OSErr PGetNextEvent(void)
- {
- Ptr nextLink;
-
- SetUpA4();
-
- nextLink = gGetNextEventLink;
-
- InitMidi();
- UpdateChannels();
-
- StartNote(GNEChannel, GNEPitch, GNEVelocity);
-
- asm {
- move.l (sp)+,a4
- move.l nextLink,a1
- unlk a6
- jmp (a1)
- }
- }
-
-
- OSErr PFrameRect(Rect *whichRect)
- {
- Ptr nextLink;
- long area;
-
- SetUpA4();
-
- nextLink = gFrameRectLink;
- area = (long)(whichRect->right - whichRect->left) * (whichRect->bottom - whichRect->top);
-
- StartNote(FRChannel, 127 - area/3000, FRVelocity);
-
- asm {
- move.l (sp)+,a4
- move.l nextLink,a1
- unlk a6
- jmp (a1)
- }
- }
-
- OSErr PIconUtils(void)
- {
- Ptr nextLink;
-
- asm
- { move.l d0,-(sp) }
- SetUpA4();
-
- nextLink = gIconUtilsLink;
-
- StartNote(IUChannel, IUPitch, IUVelocity);
-
- asm {
- move.l (sp)+,a4
- move.l (sp)+,d0
- move.l nextLink,a1
- unlk a6
- jmp (a1)
- }
- }
-
-
- OSErr PTEKey(Handle te,short key)
- {
- Ptr nextLink;
-
- SetUpA4();
-
- nextLink = gTEKeyLink;
-
- StartNote(TKChannel, (key & 0x3f) + 64, TKVelocity);
-
- asm {
- move.l (sp)+,a4
- move.l nextLink,a1
- unlk a6
- jmp (a1)
- }
- }
-
-
-